package org.sixtynine.stock.util;

import java.util.List;

import org.sixtynine.stock.cache.CompanyDto;
import org.sixtynine.stock.controller.front.ChartsPage;
import org.sixtynine.stock.entity.BaseEntity;

/**
 * factory method which gives you the required chart type
 * 
 * @author Thilanka
 * 
 */
public class ChartDataFactory {
	public static List<BaseEntity> getChartData(CompanyDto companyDto,
			String type) {
		if (type.equals(ChartsPage.TIME_RANGE_DAILY)) {
			return companyDto.getDailyShareData();
		} else if (type.equals(ChartsPage.TIME_RANGE_MONTHLY)) {
			return companyDto.getMonthlyShareData();
		} else if (type.equals(ChartsPage.TIME_RANGE_YEARLY)) {
			return companyDto.getAnnualPriceData();
		} else if (type.equals(ChartsPage.TIME_RANGE_WEEKLY)) {
			return companyDto.getWeeklyShareData();
		}

		return null;
	}
}
